<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>第一个 ECharts 实例</title>
    <style>
        body{
            margin: 0;
            padding: 0;
        }
    </style>
</head>
<body>
<!-- 为ECharts准备一个具备大小（宽高）的Dom -->
<div id="main" style="width: 100vw;height: 100vh"></div>

<script src="./js/app.js"></script>
<!--<script src="./js/echarts.js"></script>-->
<script src="./js/dist/echarts.min.js"/>
<script src="./js/jquery-3.5.1.min.js"></script>
<script type="text/javascript">

    var chartDom = document.getElementById('main');
    var myChart = echarts.init(chartDom,'dark');
    myChart.on("click", clickFun);
    var option;
    option && myChart.setOption(option);

    var data = app_json
    data.children.forEach(function (datum, index) {
        datum.collapsed = false
    });


    myChart.setOption(option = {
        tooltip: {
            trigger: 'item',
            triggerOn: 'mousemove',
            show: false
        },
        series: [
            {

                type: 'tree',

                data: [data],

                top: '1%',
                left: '7%',
                bottom: '1%',
                right: '20%',

                symbolSize: 7,

                label: {
                    position: 'left',
                    verticalAlign: 'middle',
                    align: 'right',
                    fontSize: 12
                },

                leaves: {
                    label: {
                        position: 'right',
                        verticalAlign: 'middle',
                        align: 'left'
                    }
                },

                itemStyle:{
                    color:'#d90e0e',
                    // borderWidth:3,
                },

                emphasis: {
                    focus: 'descendant'
                },

                expandAndCollapse: true,
                animationDuration: 550,
                animationDurationUpdate: 750
            }
        ]
    });

    function clickFun(param){
        if (param.type == 'click' && param.data.page) {
            // window.location.href = param.data.page
            if (param.data.page.indexOf('http') != -1){
                window.open(param.data.page)
            }else {
                window.open('./html/'+param.data.page)
            }
        }
    }


</script>
</body>
</html>